FTP from axapta
From Development axapta By (dahlsgaard Jan)
Add at Class Declaration Of Wininet class The following:
Dllfunction internetconnect; dllfunction ftpgetfile; dllfunction ftpputfile; dllfunction setcurrentdirectory; #
To create a basic step:
1, with a internetopen call to set up the environment.
2, call the InternetConnect function to connect with the host.
3, call FtpGetFile to reach the file.
4, close the 1th, 2 steps to create the handle, with the
FTP SessionsFTP SessionThe Win32 Internet functions can is used to provide applications with the ability to navigate and manipulate directories a nd files on a FTP server. Applications that use a CERN proxy exclusively must use the InternetOpenUrl
Option explicit
Public const max_path = 260 'is defined by MFC and cannot be changed.
Public const internet_open_type_preconfig = 0Public const internet_open_type_direct = 1Public const internet_open_type_proxy = 3
Public const internet_invalid_port_
. Net does not have a dedicated FTP class. We can call the ftp. EXE that comes with the system or the wininet. dll in Win32 API to complete basic operations. I hope the following code can help you.
Method 1: Use ftp.exe to call it through the
Option explicit
Public declare function internetopen lib "wininet. dll" alias "internetopena "_(Byval sagent as string, byval laccesstype as long, byval sproxyname as string ,_Byval sproxybypass as string, byval lflags as long) as long
Public
Public Functionfunc_ftp (operation,servername,username,password,remotelocation,locallocation)'Set up the environmentConstInternet_open_type_direct =1Extern.declare Miclong,"InternetOpen","Wininet.dll","Internetopena", Micstring, Micdword, micstring,
Upload | download Option Explicit
Public Declare Function internetopen Lib "Wininet.dll" Alias "Internetopena" _
(ByVal sagent As String, ByVal Laccesstype as Long, ByVal Sproxyname As String, _
ByVal Sproxybypass as String, ByVal lflags as long)
Download
. NET does not specifically handle FTP classes, we can do the basic operation by invoking the FTP.EXE of the system itself or by invoking the Wininet.dll in the Win32 API. Hope that the following code for everyone.
Method One: Use Ftp.exe
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.